Header
	title   = "Jumalauta - Father of The Great Nation - The Psilocybin Mix"
	music   = "data/kekkonen.ogg"
	bpm     = 140
	fullscreen = 1
End



Resources
	head.jpg = buffer( auto -repeat )
	kuva	 = image( "data/images/kekkonen.jpg" )
	kekko    = image( "data/images/kekkonen.png" -repeat )
	pallu.jpg = image( "data/images/psy.png" )
	psyraali = image( "data/images/spiral.jpg" )
	jml = image( "data/images/jml.jpg" )
End



Objects
	cam    = camera()
	bg     = layer( kuva, jml )
	obu    = 3ds( "data/3ds/heik-ki.3ds" )
	obu2   = 3ds( "data/3ds/pallu.3ds" )
	layer1 = layer( kekko, kuva )
	layer2 = layer( kekko )
	buf1   = layer( head.jpg )
	spiral = layer( psyraali )
End



Script
	#0.0 run( init )

	#0.0 run( scene1 )

	#4.0 enable( obu )
	#4.0 enable( 1, obu )
	#4.0 run( scene1b )

	#8.0 run( scene2 )
	#8.0 run( scene1 )

	#12.0 run( scene2 )
	#12.0 run( scene1b )

	#16.0 run( scene2 )
	#16.0 run( scene1 )
	#16.0 run( spiraali )

	#20.0 run( scene2 )
	#20.0 run( scene1b )
	#20.0 run( spiraali )

	#24.0 run( vali )

	#26.0 buf1.offset.x = 0 to 16 in #8.0
	#26.0 disable( obu )
	#26.0 disable( 1, obu )

	#26.0 run( scene2 )
	#26.0 run( spiraali )

	#30.0 run( scene2 )
	#30.0 run( spiraali )

	#34.0 enable( obu, buf1 )
	#34.0 enable( 1, obu, buf1 )
	#34.0 run( scene2 )
	#34.0 run( scene1 )
	#34.0 run( spiraali )

	#38.0 buf1.offset.x = 0 to 8 in #4.0
	#38.0 run( scene2 )
	#38.0 run( scene1b )
	#38.0 run( spiraali )

	#42.0 run( loppu )
End



Sub:init
	// Set render pipe #0
	#0.0 enable( cam, buf1 )
	#0.0 obu.materials.0.sphereMap = 1
	#0.0 cam.clip.near = 0.1
	#0.0 buf1.blending = 2
	#0.0 layer1.blending = 1
	#0.0 layer2.blending = 1
	#0.0 spiral.blending = 2

	// Set render pipe #1
	#0.0 pipe 1 = buffer
	#0.0 enable( 1, bg, cam, buf1 )
	#0.0 buf1.renderToBuffer = 1
	#0.0 buf1.feedback = 0.5
End



Sub:scene1
	#0.0 run( kekkosViuh, 100 )
	#1.0 run( kekkosViuh, 200 )
	#2.0 run( kekkosViuh, 300 )
	#3.0 run( kekkosViuh, 0 )
	#2.0 bg.rotate = 0 to 360 in #2.0

	#0.0 run( setRandomCam, 4 )
	#0.1 run( setRandomCam, 3 )
	#0.2 run( setRandomCam, 2 )
	#0.3 run( setRandomCam, 3 )
	#1.0 run( setRandomCam, 4 )
	#1.1 run( setRandomCam, 3 )
	#1.2 run( setRandomCam, 2 )
	#2.0 run( setRandomCam, 4 )
	#2.1 run( setRandomCam, 3 )
	#2.2 run( setRandomCam, 2 )
	#2.3 run( setRandomCam, 3 )
	#3.0 run( setRandomCam, 4 )
	#3.1 run( setRandomCam, 5 )
	#3.2 run( setRandomCam, 2 )
End


Sub:kekkosViuh
	#0.0.00 bg.zoom = 500 to 100 in #0.0.25
	#0.0.25 bg.zoom = 100 to 500 in #0.2
	#0.2.25 bg.zoom = 500 to 100 in #0.0.25
	#0.3.00 bg.zoom = 100 to 500 in #0.1
	#0.3 bg.zoom.y = 0 to %0 in #0.1

	#0.0 cam.aspect = 0.5 to 2 in #0.1
	#0.1 cam.aspect = 2 to 0.5 in #0.1
	#0.2 cam.aspect = 0.1 to 3 in #0.1
	#0.3 cam.aspect = 3 to 0.1 in #0.1
End



Sub:scene1b
	#0.0 run( kekkosViuh, 100 )
	#1.0 run( kekkosViuh, 200 )
	#2.0 run( kekkosViuh, 300 )
	#3.0 run( kekkosViuh, 0 )
	#2.0 bg.rotate = 0 to 360 in #2.0

	#0.0 run( setRandomCam, 4 )
	#0.1 run( setRandomCam, 3 )
	#0.2 run( setRandomCam, 2 )
	#0.3 run( setRandomCam, 3 )
	#1.0 run( setRandomCam, 4 )
	#1.1 run( setRandomCam, 3 )
	#1.2 run( setRandomCam, 2 )
	#2.0 run( setRandomCam, 4 )
	#2.1 run( setRandomCam, 3 )
	#2.2 run( setRandomCam, 2 )
	#2.3 run( setRandomCam, 3 )

	#3.0 enable( layer1 )
	#3.2 enable( layer2 )
	#3.2 layer2.offset.x = -0.390625
	#4.0 disable( layer1, layer2 )

End



Sub:scene2
	#0.0 enable( layer1, obu2 )
	#0.0 enable( 1, obu2 )
	//#0.0 layer1.blending = 2
	#0.0 layer2.alpha = 0
	#0.0 layer1.show = 1
	#0.0 obu2.rotate.x = 0 to 360 in #4.0
	#0.0 obu2.rotate.y = 0 to 720 in #4.0

	#0.1 run( fadeOutKekkonen )
	#0.3 run( fadeOutKekkonen )
	#1.1 run( fadeOutKekkonen )
	#1.3 run( fadeOutKekkonen )
	#2.1 run( fadeOutKekkonen )
	#2.3 run( fadeOutKekkonen )
	#3.1 run( fadeOutKekkonen )
	#3.3 run( fadeOutKekkonen )
End

Sub:fadeOutKekkonen
	#0.0 layer1.alpha = 1 to 0 in #0.2
	#0.0 layer1.zoom = 100 to 110 in #0.2
End




Sub:spiraali
	#0.0 enable( spiral )
	#0.0 spiral.zoom = 100 to 300 in #2.0
	#2.0 spiral.zoom = 300 to 100 in #2.0
	#0.0 spiral.rotate = 0 to 720 in #4.0
End




Sub:vali
	#0.0 disable( obu, buf1 )
	#0.0 disable( 1, obu, buf1 )

	#0.0 spiral.zoom = 100
	#0.0 spiral.rotate = 0 to 360 in #2.0
	#0.0 spiral.brightness = 1 to 0 in #2.0

	#1.0 enable( layer1 )
	#1.0 layer1.show = 0
	#1.0 layer1.blending = 1
	#1.0 layer1.alpha = 1

	#1.2 enable( layer2 )
	#1.2 layer2.offset.x = -0.390625
	#1.2 layer2.alpha = 1


	#2.0 disable( layer2 )

	#2.0 enable( obu, buf1 )
	#2.0 enable( 1, obu, buf1 )
End



Sub:loppu
	#0.0 enable( bg )
	#0.0 disable( obu, buf1 )
	#0.0 disable( 1, obu, buf1 )

	#0.0 spiral.zoom = 1000 to 0 in #8.0
	#0.0 spiral.rotate = 0 to 4000 in #8.0
	#0.0 spiral.brightness = 1
	#0.0 bg.show = 1
	#0.0 bg.brightness = 0 to 1 in #2.0
	#0.0 bg.zoom = 50 to 100 in #8.0

	#10.0 bg.brightness = 1 to 0 in #1.0
	#12.0 end
End



Sub:setRandomCam
	#0.0 cam.pos.x = ( rand( -1, 1, 0.1 ) ) to 0 in #0.1
	#0.0 cam.pos.y = ( rand( -1, 1, 0.1 ) ) to 0 in #0.1
	#0.0.00 cam.pos.z = %0
	#0.0.50 cam.pos.z = 2

	#0.0 obu.rotate.x = -90
	//#0.0 obu.rotate.y = 0 to 360 in #1.0
	//#0.0 obu.rotate.x = %0 to %1 in #0.0.25
	//#0.0 obu.rotate.z = %0 to %1 in #0.0.25
	//#0.0 obu.rotate.y = 0 to 200 in #1.0

	//#0.0.00 cam.pos.z = 1 to 2 in #0.0.25
End


// end of file
